const { argv } = require('yargs');
const isDev = argv.mode === 'development';
const plugins = [];
module.exports = (api) => {
  api.cache(true);
  return {
      presets: [
          [
              '@babel/preset-env',
              {
                  corejs: 3.9,
                  useBuiltIns: 'usage',
              }, ],
          [ '@babel/preset-react',
            {
                  runtime: 'automatic',
             }],
          '@babel/preset-typescript',
      ],
      plugins: isDev ? [...plugins, 'react-refresh/babel'] : [...plugins],
  };
};